package jee.boot.module.crud.rest;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jee.boot.common.basic.CrudController;
import jee.boot.common.basic.result.ResponseMessage;
import jee.boot.common.basic.result.Result;
import jee.boot.module.crud.entity.DemoCrud;
import jee.boot.module.crud.service.DemoCrudService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 示例-单表操作RestController
 * @author
 * @version 2019-06-19
 */
@Api(tags="示例-单表操作")
@RestController
@RequestMapping(value = "/crud/demoCrud")
public class DemoCrudRestController extends CrudController<DemoCrudService,DemoCrud> {
    /**
     * 查看
     *
     * @param entity
     * @return
     */
    @PostMapping("/getData")
    @ApiOperation(value = "查看")
    public ResponseMessage<DemoCrud> getData(@RequestBody @Validated DemoCrud entity) {
        DemoCrud data =service.get(entity);
        return Result.success(data);
    }
}